const listBehavior = require("../../../behaviors/list");
Component({
    behaviors: [listBehavior],
    options: {
        multipleSlots: true // 在组件定义时的选项中启用多 slot 支持
    },
    /**
     * 组件的属性列表
     */
    properties: {
        leftWidth: {
            type: Number,
            value: 0
        },
        rightWidth: {
            type: Number,
            value: 0
        },
        hasLeft: {
            type: Boolean,
            value: false
        },
        hasLeft1: {
            type: Boolean,
            value: false
        },
        hasLeft2: {
            type: Boolean,
            value: false
        },
        hasRight: {
            type: Boolean,
            value: false
        },
        hasRight1: {
            type: Boolean,
            value: false
        },
        hasRight2: {
            type: Boolean,
            value: false
        }
    },

    /**
     * 组件的初始数据
     */
    data: {},

    /**
     * 组件的方法列表
     */
    methods: {
        onSwipeClose({detail: {position, instance}}) {
            switch (position) {
                case 'left':
                case 'right':
                case 'cell':
                    instance.close();
                    break;
            }
        },
        clickLeft1(event) {
            this.triggerEvent('clickleft1', {id: event.currentTarget.dataset.id});
        },
        clickLeft2(event) {
            this.triggerEvent('clickleft2', {id: event.currentTarget.dataset.id});
        },
        clickRight1(event) {
            this.triggerEvent('clickright1', {id: event.currentTarget.dataset.id});
        },
        clickRight2(event) {
            this.triggerEvent('clickright2', {id: event.currentTarget.dataset.id});
        }
    }
})
